<?php if(!defined('SABLOG_ROOT')) exit('Access Denied');?>
<div id="submenu">
	<ul>
		<li><a href="cp.php?job=category&action=catelist" <!--{if $action == 'catelist'}-->class="focus"<!--{/if}-->><span>分类管理</span></a></li>
		<li><a href="cp.php?job=category&action=addcate" <!--{if $action == 'addcate'}-->class="focus"<!--{/if}-->><span>添加分类</span></a></li>
		<li><a href="cp.php?job=category&action=taglist" <!--{if $action == 'taglist'}-->class="focus"<!--{/if}-->><span>标签管理</span></a></li>
		<li><a href="cp.php?job=category&action=tagclear" <!--{if $action == 'tagclear'}-->class="focus"<!--{/if}-->><span>标签整理</span></a></li>
		<!--{if $action == 'modcate'}-->
			<li><a href="###" class="focus"><span>编辑分类</span></a></li>
		<!--{/if}-->
		<!--{if $action == 'delcate'}-->
			<li><a href="###" class="focus"><span>删除分类</span></a></li>
		<!--{/if}-->
		<!--{if $action == 'modtag'}-->
			<li><a href="###" class="focus"><span>编辑标签</span></a></li>
		<!--{/if}-->
	</ul>
</div>

<div id="wrap">
	<form action="cp.php?job=category" method="POST">
<!--{if $action == 'catelist'}-->
	<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
		<tr class="tdbheader">
			<td width="10%" nowrap>排序</td>
			<td width="30%">分类名称</td>
			<td width="30%">URL名称</td>
			<td width="15%">文章数</td>
			<td width="15%" nowrap>操作</td>
		</tr>
		<!--{loop $catedb $cate}-->
		<!--{eval $thisbg = isset($thisbg) && $thisbg == 'tablecell' ? 'tablecell2' : 'tablecell';}-->
		<tr class="$thisbg" onmouseover="this.className='cellfocus';" onmouseout="this.className='$thisbg';">
			<td nowrap><input class="formfield" style="text-align: center;font-size: 11px;" type="text" value="$cate[displayorder]" name="displayorder[{$cate[cid]}]" size="1" /></td>
			<td><b>$cate[name]</b></td>
			<td><!--{if $cate['url']}-->$cate[url]<!--{else}--><span class="no">Null</span><!--{/if}--></td>
			<td>$cate[articles]</td>
			<td nowrap><a href="cp.php?job=article&action=add&cid=$cate[cid]">添加文章</a> - <a href="cp.php?job=category&action=modcate&cid=$cate[cid]">编辑</a> - <a href="cp.php?job=category&action=delcate&cid=$cate[cid]">删除</a></td>
		</tr>
		<!--{/loop}-->
	</table>
	<div class="submit">
		<input type="hidden" name="action" value="updatedisplayorder" />
		<button type="submit">确定</button>
	</div>
<!--{elseif in_array($action, array('addcate', 'modcate'))}-->
	<div class="input">
		<h2>排序</h2>
		<p>
			<input class="formfield" type="text" name="displayorder" size="10" maxlength="50" value="$cate[displayorder]" />
		</p>
	</div>
	<div class="input">
		<h2>分类名称</h2>
		<p>
			<input class="formfield" type="text" name="name" size="35" maxlength="50" value="$cate[name]" />
		</p>
	</div>
	<div class="input">
		<h2>URL名称</h2>
		<p>
			<input class="formfield" type="text" name="url" size="35" maxlength="50" value="$cate[url]" /><br />
			<span class="describe">100个字符以内，只能使用半角字母、数字、下划线和减号。例如 life.</span>
		</p>
	</div>
	<div class="submit">
		<input type="hidden" name="action" value="do{$action}" />
		<input type="hidden" name="cid" value="$cate[cid]" />
		<button type="submit">确定</button>
	</div>
<!--{elseif $action == 'delcate'}-->
	<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
    <input type="hidden" name="cid" value="$cate[cid]" />
    <input type="hidden" name="action" value="dodelcate" />
    <tr class="alertheader">
      <td>$subnav</td>
    </tr>
    <tr class="alertbox">
      <td><p>您确定要删除【$cate[name]】分类吗?</p>
	  <p><b>本操作不可恢复，并会删除该分类中的所有文章、附件、评论和Trackback!</b></p>
	  <p><button type="submit">确定</button></p>
	  </td>
    </tr>
	</table>
<!--{elseif $action == 'taglist'}-->
	<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
		<tr class="tdbheader">
			<td width="31%">Tags名称</td>
			<td width="32%"><a href="cp.php?job=category&action=taglist&ordered=usenum">使用次数</a></td>
			<td width="32%">操作</td>
			<td width="5%" nowrap><input name="chkall" type="checkbox" onclick="checkall(this.form)" value="on" /></td>
		</tr>
		<!--{loop $tagdb $tag}-->
		<!--{eval $thisbg = isset($thisbg) && $thisbg == 'tablecell' ? 'tablecell2' : 'tablecell';}-->
		<tr class="$thisbg" onmouseover="this.className='cellfocus';" onmouseout="this.className='$thisbg';">
			<td><a href="cp.php?job=article&action=list&tag=$tag[url]">$tag[item]</a></td>
			<td>$tag[usenum]</td>
			<td><a href="cp.php?job=category&action=modtag&tagid=$tag[tagid]">修改</a></td>
			<td nowrap><input type="checkbox" name="tag[{$tag[item]}]" value="$tag[tagid]" /></td>
		</tr>
		<!--{/loop}-->
		<tr class="tablecell">
			<td colspan="5" nowrap="nowrap"><div class="records">记录:$total</div>
			<div class="multipage">$multipage</div></td>
		</tr>
	</table>
	<div class="submit">
		<input type="hidden" name="action" value="dodeltag" />
		<input type="hidden" name="cid" value="$cate[cid]" />
		<button type="submit">删除选定标签</button>
	</div>
<!--{elseif $action == 'modtag'}-->
    <h2>修改标签&raquo;</h2>
	<div class="input">
		<h2>标签</h2>
		<p>
			<input class="formfield" type="text" name="tag" size="35" maxlength="50" value="$taginfo[item]" /><br />
			<span class="describe">使用次数: $taginfo[usenum]</span>
		</p>
	</div>
	<div class="input">
		<h2>使用文章</h2>
		<p>
			<!--{loop $articledb $article}-->
				<a href="cp.php?job=article&action=mod&articleid=$article[articleid]">$article[title]</a><br />
			<!--{/loop}-->
		</p>
	</div>
	<div class="submit">
		<input type="hidden" name="tagid" value="$taginfo[tagid]" />
		<input type="hidden" name="oldtag" value="$taginfo[item]" />
		<input type="hidden" name="action" value="domodtag" />
		<button type="submit">删除选定标签</button>
	</div>
<!--{elseif $action == 'tagclear'}-->
	<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
    <input type="hidden" name="action" value="dotagclear" />
    <tr>
      <td class="alertbox">
	  <p>程序难免记录错每篇文章的关键字和计算错每个关键字使用次数，本功能是重新统计各个Tag的使用次数和清理不使用的Tag。</p>
      <p>为了使Tags数据最准确，本次操作将清空Tags数据表，并读取每篇文章的关键字，重新写入Tags数据表，过程较久，请耐心等候。</p>
      <p>建议定期执行。</p>
	  <p>每次处理文章数: <input class="formfield" type="text" name="percount" size="15" maxlength="50" value="200" /></p>
      <p><button type="submit">确定</button></p>
	  </td>
    </tr>
	</table>
<!--{/if}-->
</form>